<template>
	<view id="app">
		<view class="container fdc">
			<view class="df fdc mtb10 bgw ">
				<view class="df ptb20 plr15 bdb1s brcce">
					<view class="w300 h180 br15 courseImg"><image :src="order.course_thumb"></image></view>
					<view class="f1 ml15 df fdc">
						<view class="f28 fw4 h120 t2hd">{{order.course_title}}</view>
						<view class="df aic cdebug f32 fw8">¥{{order.order_price}}</view>
					</view>
				</view>
			</view>
			<view class="bgw mt20 ver ais plr20">
				<view class="ptb20 f30 fw8 c000">评价信息</view>
				<view class=" rows plr20 ptb20  bdb1s brcce aic">
					<view class="f28 c333 ">订单号</view>
					<view class="f30 c000">{{order.order_sn}}</view>
				</view>
				<view class=" rows plr20 ptb20 bdb1s brcce aic">
					<view class="f28 c333 ">下单时间</view>
					<view class="f30 c000">{{order.create_time}}</view>
				</view>
				<view class=" rows plr20 ptb20 bdb1s brcce aic">
					<view class="f28 c333 ">核销时间</view>
					<view class="f30 c000">{{order.user_time}}</view>
				</view>
				<view class=" rows plr20 ptb20  ">
					<view class="f28 c333 ">评星</view>
					<uv-rate :count="5" v-model="star" size="50rpx"></uv-rate>
				</view>
				<view class=" rows plr20 ptb20  ">
					<view class="f28 c333 ">评价内容</view>
				</view>
				<view class="plr20">
					<uv-textarea v-model="content" placeholder="请输入内容"></uv-textarea>
				</view>
				<view class="plr20 ptb20">
					<uv-button text="提交评价" color="#145cfe" @click="submitComment()"></uv-button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	let that ;
	export default {
		data() {
			return {
				id:0,
				star:5,
				content:"",
				order:{},
			}
		},
		onLoad(e){
			that = this;
			if(e.id){
				this.id = e.id;
			}
			this.getDetail()
		},
		methods: {
			submitComment:function(){
				that.request({
					url:"/api/order/comment",
					data:{id:this.id},
					success:function(res){
						if(res.code =='200'){
							that.alert('评价完成');
							setTimeout(function(){
								uni.navigateBack();
							},1000)
						}
					}
				})
			},
			getDetail:function(){
				this.request({
					url:"/api/order/detail",
					data:{id:this.id},
					success:function(rlt){
						if(rlt.code == '200'){
							that.order = rlt.data;
						}
					}
				})
			},
			handle(e){
				uni.navigateTo({
					url:"/pages/"+e,
				})
			}
		},
	}
</script>

<style>

</style>
